﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace Flavio
{
    public class Program
    {
        public static void Main()
        {
            string word1 = "cat";
            string word2 = "tac";

            Console.WriteLine(IsAnagramOf(word1, word2));

            string word3 = "cat";
            string word4 = "dog";

            Console.WriteLine(IsAnagramOf(word3, word4));
            Console.ReadKey();
        }
        
        public static bool IsAnagramOf(string word1, string word2)
        {
            Contract.Requires(word1 != null);
            Contract.Requires(word2 != null);
            return word1.OrderBy(x => x).SequenceEqual(word2.OrderBy(x => x));
        }
    }
}



